<template>
	<view>
		<block v-for="(item,index) in kucunInfo" :key="index">
			<view class="list" >
			<view  @tap="ifShow(index)" class="cu-form-group">
				<view class="title">兽药名称</view>
				<input disabled="true"  :placeholder="item.purchasePharmacy" name="input"></input>
				<text v-if="ind === index?true:false" class="icon iconfont">&#xe601;</text>
				<text v-else class="icon iconfont">&#xe600;</text>
				</view>
				<template  v-if="ind === index?true:false">
					<view class="cu-form-group">
						<view class="title">兽药类型</view>
						<input  disabled="true"  :placeholder="item.purchaseTypeId>0?'一类':'二类'" name="input"></input>
					</view>
					<view class="cu-form-group">
					<view class="title">使用对象</view>
					<input disabled="true"  :placeholder="item.purchaseTypeId" name="input"></input>
					</view>
					<view class="cu-form-group">
					<view class="title">购入数量</view>
					<input  disabled="true"  :placeholder="item.purchaseNumber" name="input"></input>
					</view>
					<view class="cu-form-group">
					<view class="title">库存数量</view>
					<input  disabled="true"  :placeholder="item.purchaseSurplus" name="input"></input>
					</view>
					<view class="cu-form-group">
					<view class="title">购入日期</view>
					<input  disabled="true"  :placeholder="item.purchaseTime" name="input"></input>
					</view>
					<view class="cu-form-group">
					<view class="title">过期时间</view>
					<input  disabled="true"  :placeholder="item.purchaseOverdue" name="input"></input>
					</view>
					<view class="cu-form-group">
					<view class="title">花费金额</view>
					<input disabled="true"  :placeholder="item.purchaseMoney" name="input"></input>
					</view>
					<view class="cu-form-group">
					<view class="title">采购人</view>
					<input  disabled="true" :placeholder="item.purchasePeople" name="input"></input>
					</view>
					<view class="cu-form-group">
					<view class="title">采购人电话</view>
					<input disabled="true" :placeholder="item.purchasePhone" name="input"></input>
					</view>
					<view class="cu-form-group">
					<view class="title">药品供应商</view>
					<input disabled="true"  :placeholder="item.purchaseMerchant" name="input"></input>
					</view>
					<view class="cu-form-group">
					<view class="title">供应商电话</view>
					<input disabled="true"  :placeholder="item.purchaseMerchantPhone" name="input"></input>
					</view>
				</template>
				
			</view>
		</block>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				kucunInfo:'',
				ind:'',
			}
		},
		onReady() {
			this.findMedicationStockList();
		},
		onNavigationBarButtonTap() {
			uni.navigateTo({
				url:"./addkucun"
			})
		},
		methods: {
			//是否显示
			ifShow(index){
				this.ind = this.ind === index ? !index : index;
			},
			//获取库存记录
			findMedicationStockList(){
				uni.request({
					url:this.confige.webUrl+'/livestock/findMedicationStockList',
					data:{
						farmId:this.User.userInfo.farm_id,
						limits:10,
						pages:1
					},
					header:{
						'X-Token':this.User.token
					},
					success: (res) => {
						// console.log(res)	
						this.kucunInfo = res.data.result[0].list
					}
				})
			},
		}
	}
</script>

<style lang="less">
	@import '../../../common/main.css';
	@import "../../../common/iconfont.css";
	@import "../../../common/iconReg.css" ;
	.list{
		margin-bottom: 20rpx;
	}
</style>
